import axios from 'axios'
import {API_ROOT} from '../util/config'
const httproot ="http://1.dltest.applinzi.com/test2.php"
const httprootget ="http://1.dltest.applinzi.com/get.php"
const httpkuaxueResource="http://api.kuaxue.com/KuaxueResource/"
const httpkuaxueVideo="http://api.kuaxue.com/KuaxueVideo/"
const appId='vke8u7u7y3'
const qs = require('qs')
//一般的传入参数为0 后台减少参数对应的筛选条件
export default{
	//获取时光轴信息
	getClassLessonRecordsOfStudent(params){
		return axios.get(API_ROOT+"action=getClassLessonRecordsOfStudent",{
			params
		})
	},
	//获取每日名言警句
	getStudentEduMotto(params){
		return axios.get(API_ROOT+"action=getStudentEduMotto",{
			params
		})
	},
	//获取错题本的总览信息
	getWrongBookInfo(params){
		return axios.get(API_ROOT+"action=getStudentMistakesList",{
			params
		})
	},
	//获取某科目错题id集合
	getStudentMistakesListIdsOfCourse(params){
		return axios.get(API_ROOT+"action=getStudentMistakesListIdsOfCourse",{
			params
		})
	},
	//获取科目错题本详情信息
	getSubjectWrong(params){
		return axios.get(API_ROOT+"action=getStudentMistakesListOfCourse",{
			params
		})
	},
	//删除某道错题
	deleteMistakes(params){
		return axios.get(API_ROOT+"action=deleteTheMistakes",{
			params
		})
	},
	//获取与该知识点相关的题目
	getExamQuestionList(params){
		return axios.get(API_ROOT+"action=getExamQuestionList",{
			params
		})
	},
	//获取诊断消息
	getStudyDiagInfo(params){
		return axios.get(API_ROOT+"action=getStudentLearningDiagnosis",{
			params
		})
	},
	//传递科目知识点信息
	addStudentPracticeOfCourse(params){
		return axios.get(API_ROOT+"action=addStudentPracticeOfCourse",{
			params
		})
	},
	//获取诊断科目知识点信息
	getStudentPracticeOfCourse(params){
		return axios.get(API_ROOT+"action=getStudentPracticeOfCourse",{
			params
		})
	},
	//提交做题信息，做的科目，知识点，做到第几页，第几道题
	updateStudentPractice(params){
		return axios.get(API_ROOT+"action=updateStudentPractice",{
			params
		})
	},
	//获取作业记录0未提交，1已提交
	getStudentAssignmentList(params){
		return axios.get(API_ROOT+"action=getStudentAssignmentList",{
			params
		})
	},
	//获取某个作业的记录详情
	getStudentAssignment(params){
		return axios.get(API_ROOT+"action=getStudentAssignment",{
			params
		})
	},
	//提交作业记录
	putStudentAssignment(params){
		return axios.get(API_ROOT+"action=putStudentAssignment",{
			params
		})
	},
	//获取课堂表现
	getStudentLessonrecords(params){
		return axios.get(API_ROOT+"action=getStudentLessonrecords",{
			params
		})
	},
	//获取课堂答题详情
	getStudentLessonrecordsOfXiti(params){
		return axios.get(API_ROOT+"action=getStudentLessonrecordsOfXiti",{
			params
		})
	},
	//获取点名详情
	getStudentLessonrecordsOfCallName(params){
		return axios.get(API_ROOT+"action=getStudentLessonrecordsOfCallName",{
			params
		})
	},
	//获取抢答详情
	getStudentLessonrecordsOfCompetitive(params){
		return axios.get(API_ROOT+"action=getStudentLessonrecordsOfCompetitive",{
			params
		})
	},
	//根据结构ID、题型ID、级别ID获取试题列表
  	getListQuestion(params){
  		return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  			return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getListQuestion?sign='+out.data+'&appid='+appId+'&category_id='+params.category_id+"&type_id="+params.type_id+"&level_id="+params.level_id+"&page="+params.page}))
  		})
  	},
  	//根据试题id获取试题
  	getListQuestionById(tid){
  		return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  			return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getOneQuestion?sign='+out.data+'&appid='+appId+'&tid='+tid}))
  		})
  	},
  	//根据科目ID获取章节或知识点的结构  0章节，1知识点
  	getKnowledges(params){
  		return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  			return axios.post(httprootget,qs.stringify({url:httpkuaxueResource+'getListCategory?sign='+out.data+'&appid='+appId+'&subject_id='+params.subject_id+"&type="+params.type}))
  		})
  	}, 
  //获取视频的知识点结构目录 type 1教材同步，2知识点
  getVideoKnowledges(type){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueVideo+'classify/'+out.data+'/'+appId+'/'+type}))
  	})
  }, 
  //获取视频参数3=结构id（第2个接口中的id），*参数4=知识点的级别值（第2个接口中的type），*参数5=每页条数，*参数6=页码（选填）
  getVideoList(id,typeid,pagesize,page){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueVideo+'getVideoList/'+out.data+'/'+appId+'/'+id+'/'+typeid+'/'+pagesize+'/'+page}))
  	})
  },  
  //获取某个视频详情
  getVideoDetail(id){
  	return axios.post(httproot,qs.stringify({'appId':appId})).then(function(out){
  		return axios.post(httprootget,qs.stringify({url:httpkuaxueVideo+'videos/'+out.data+'/'+appId+'/'+id}))
  	})
  }  
}